<?php
	
	include_once $_SERVER ['DOCUMENT_ROOT'] . '/nhr/library/util/Regex.php';
	
	$regex = new Regex();
	
	header("Content-Type:text/html; charset=utf-8");
	
	echo "<br><b>檢查帳號</b><br>";
	//檢查帳號
	$accountItem = array(
							"tes",
							"test",
							"test-9894"
						);
	
	foreach($accountItem as $row){
		echo $row."檢查結果:".( $regex->isAccount($row) ? "正確" : "錯誤" )."<br>";
	}
	
	
	echo "<br><b>檢查密碼</b><br>";
	//檢查密碼
	$passwordItem = array(
							"tes",
							"test",
							"test9894DSKAOPDK"
						);
	
	foreach($passwordItem as $row){
		echo $row."檢查結果:".( $regex->isPassword($row) ? "正確" : "錯誤" )."<br>";
	}
	
	
	echo "<br><b>檢查信箱</b><br>";
	//檢查信箱
	$emailItem = array(
							"l@gmail.com",
							"louis.Wu@gmail.com",
							"louis_Wu@gmail.com"
						);
	
	foreach($emailItem as $row){
		echo $row."檢查結果:".( $regex->isEmail($row) ? "正確" : "錯誤" )."<br>";
	}
	
	
	echo "<br><b>檢查電話</b><br>";
	//檢查電話
	$phoneItem = array(
							"886985357871"
						);
	
	foreach($phoneItem as $row){
// 		echo $row."檢查結果:".( $regex->isPhone($row, 50) ? "正確" : "錯誤" )."<br>";
	}
	
	
	echo "<br><b>檢查連結</b><br>";
	//檢查連結
	$urlItem = array(
						"ftp://ftp.is.co.za.example.org/rfc/rfc1808.txt",
						"http://www.xiami.com/search?key=%E9%83%81%E5%8F%AF%E5%94%AF&pos=1",
						"https://php.net/manual/en/filter.filters.validate.php",
						"mailto:mduerst@ifi.unizh.example.gov"
					);
	
	foreach($urlItem as $row){
		echo $row."檢查結果:".( $regex->isUrl($row) ? "正確" : "錯誤" )."<br>";
	}
	
	
	echo "<br><b>檢查整數</b><br>";
	//檢查整數
	$numberItem = array(
							"1234567890",
							"12345678901",
							"123456789012",
							"12.4535374",
							"fdasasdasd"
						);
	
	foreach($numberItem as $row){
		echo $row."檢查結果:".( $regex->isNumber($row) ? "正確" : "錯誤" )."<br>";
	}
	
	
	echo "<br><b>檢查小數</b><br>";
	//檢查小數
	$floatItem = array(
							"1234567890",
							"12345678901",
							"123456789012",
							"12.4535374",
							"fdasasdasd"
						);
	
	foreach($floatItem as $row){
		echo $row."檢查結果:".( $regex->isFloat($row) ? "正確" : "錯誤" )."<br>";
	}
	
	
	echo "<br><b>檢查標點符號</b><br>";
	//檢查標點符號
	$punctuationItem = array(
								"12345678,0",
								"123456789-01",
								"1234567890;12",
								"12*4535374",
								"fdasasdasd"
							);
	
	foreach($punctuationItem as $row){
		echo $row."檢查結果:".( $regex->isPunctuation($row) ? "正確" : "錯誤" )."<br>";
	}
	
	
// 	echo "<br><b>檢查編輯器</b><br>";
// 	//檢查編輯器
// 	$editorItem = array(
// 							"test",
// 							"123456789-01<script>",
// 							"1234567890;12</html>",
// 							"12*4535374</body>",
// 							"fdasasdasd<body>"
// 						);
	
// 	foreach($editorItem as $row){
// 		echo $row."檢查結果:".( $regex->isEditor($row) ? "正確" : "錯誤" )."<br>";
// 	}
	
	
	echo "<br><b>檢查HTML標籤</b><br>";
	//檢查HTML標籤
	$htmltagItem = array(
							"test",
							"123456789-01<script>",
							"1234567890;12</html>",
							"12*4535374</body>",
							"fdasasdasd<body>"
						);
	
	foreach($htmltagItem as $row){
		echo $row."檢查結果:".( $regex->isHtmlTag($row) ? "正確" : "錯誤" )."<br>";
	}

?>